package learning.groovy.command

import java.text.SimpleDateFormat

def backupFileName=new SimpleDateFormat('yyyyMMddHHmmss').format(new Date())+(new Random().nextInt(8999)+1000)
def targertFilePath="./file/"+backupFileName+".sql";
def str="\"C:/Program Files (x86)/MySQL/MySQL Server 5.5/bin/mysqldump\" -uroot -proot test2 > "+targertFilePath;
def command="cmd /c "+str
Process p4DbBack=command.execute()
//Thread.sleep(30*1000);//等待备份文件的存储
println "数据库备份完成！${p4DbBack.text}"

